Skip to content

🎨 Palette: [UX improvement]#190

Open
haseeb-heaven wants to merge 1 commit into
mainfrom
palette-tui-ux-12987733572144168556
Open

🎨 Palette: [UX improvement]#190
haseeb-heaven wants to merge 1 commit into
mainfrom
palette-tui-ux-12987733572144168556

Conversation

@haseeb-heaven

@haseeb-heaven haseeb-heaven commented Jul 5, 2026

Copy link
Copy Markdown
Owner

💡 What: Improved the terminal UI by handling Ctrl-C (\x03) to explicitly cancel operations, adding visible "(Ctrl-C to cancel)" hints in the selector footer, and explicitly displaying available choices in the interactive text prompt (e.g., Mode \[code|chat|...]).
🎯 Why: The TUI previously swallowed Ctrl-C inputs in raw mode, making it hard to exit. The interactive text prompt did not show available options, forcing users to guess or rely on defaults.
📸 Before/After: Before, no cancel hint, Ctrl-C swallowed, and text prompt showed Mode: only. After, explicit cancel support and hint, and text prompt shows Mode \[code|chat|script|command|vision].
♿ Accessibility: Enhances keyboard navigation accessibility by providing standard interrupt capabilities and explicit option visibility.


PR created automatically by Jules for task 12987733572144168556 started by @haseeb-heaven

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard cancellation in the terminal UI so Ctrl-C consistently cancels selections across platforms.
    • Updated on-screen guidance to show cancel behavior more clearly when it isn’t already mentioned.
    • Refined non-interactive prompts to display available choices inline, making them easier to understand at a glance.
  • Documentation
    • Added a note clarifying terminal input cancellation behavior and prompt formatting expectations.

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Terminal UI's key-reading logic now explicitly raises KeyboardInterrupt when Ctrl-C is detected on Windows and POSIX input paths. The selector footer displays a Ctrl-C cancel hint, and the non-TTY prompt text now includes bracketed options. Palette documentation notes these conventions.

Changes

TUI cancellation and prompt updates

Layer / File(s) Summary
Ctrl-C cancellation handling
libs/terminal_ui.py
_read_key explicitly checks for '\x03' on both Windows (msvcrt.getwch) and POSIX (raw-mode stdin read) branches and raises KeyboardInterrupt('Selection cancelled by user.').
Selector footer and prompt text
libs/terminal_ui.py, .jules/palette.md
_render_selector appends "(Ctrl-C to cancel)" to the footer when not already present; _select_option's non-TTY prompt now shows a bracketed, pipe-separated options hint alongside the title; palette notes document these conventions and prompt escaping guidance.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

Not applicable for this change.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and doesn't describe the terminal UI cancellation and prompt-option changes. Rename it to clearly mention the main change, such as explicit Ctrl-C handling and improved prompt option display.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette-tui-ux-12987733572144168556

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
libs/terminal_ui.py (1)

82-91: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider using Rich's native choices/case_sensitive support instead of manual formatting.

Prompt.ask already supports choices=[...] and case_sensitive=False, which would render/validate the bracketed options natively and eliminate the manual .join, bracket-escaping, and case-insensitive fallback loop here.

♻️ Simplify using native Prompt.ask choices
-            default_choice = default if default in options else options[0]
-            answer = Prompt.ask(f"{title} \\[{'|'.join(options)}]", default=default_choice).strip()
-            if answer in options:
-                return answer
-            for option in options:
-                if option.lower() == answer.lower():
-                    return option
-            return default_choice
+            default_choice = default if default in options else options[0]
+            return Prompt.ask(title, choices=options, default=default_choice, case_sensitive=False).strip()

Please verify this preserves the desired bracketed-hint display and case-insensitive matching behavior in the target Rich version before adopting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/terminal_ui.py` around lines 82 - 91, The option selection logic in
_select_option manually builds the bracketed prompt and reimplements
case-insensitive matching; switch Prompt.ask to use Rich’s native choices and
case_sensitive=False support instead. Keep the same default-selection behavior
in the non-TTY path, but let Prompt.ask render the option hint and validate
input directly instead of using the manual join, escaped brackets, and fallback
comparison loop. Verify the Rich version in use preserves the desired bracketed
display and matching behavior before removing the custom logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@libs/terminal_ui.py`:
- Around line 82-91: The option selection logic in _select_option manually
builds the bracketed prompt and reimplements case-insensitive matching; switch
Prompt.ask to use Rich’s native choices and case_sensitive=False support
instead. Keep the same default-selection behavior in the non-TTY path, but let
Prompt.ask render the option hint and validate input directly instead of using
the manual join, escaped brackets, and fallback comparison loop. Verify the Rich
version in use preserves the desired bracketed display and matching behavior
before removing the custom logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2bb83f6c-6ee8-4d89-bdc1-403dcaa0be13

📥 Commits

Reviewing files that changed from the base of the PR and between 2a47494 and 32899cf.

📒 Files selected for processing (2)
  • .jules/palette.md
  • libs/terminal_ui.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant